#ifndef _MY_ENEMY_H_
#define _MY_ENEMY_H_
#include "myobject.h"
#include <list>

using namespace std;

namespace fireplane
{
	class Camera;
	class Player;

	class Enemy : public Object
	{
	public:
		enum EnemyType
		{
			ET_normal = 0,
			ET_npc1,
            ET_npc2,
			ET_npc3,
			ET_npc4,
			ET_npc5,
			ET_npc6
		};

		struct CreateArg{
			EnemyType _id;
		};

		struct CreateNormalEnemy : CreateArg{
			CCPoint pos;
		};

		// all Enemys

		static void pushCreateCmd(CreateArg* arg);
		static Enemy* _createEnemy(CreateArg* arg);
		static void updateAllEnemys(float dt);
		static void initEnemyanager(CCNode* parent);
		static void destroyEnemyManager();
		static void processCreateCmds();

		Enemy(EnemyType type);
		~Enemy();

		virtual void onInit(CreateArg* arg) = 0;
		virtual void destroy();
		virtual void onAttack() = 0;
		virtual void onCollision2Player() = 0;

		list<CCRect>& getCollisionRect();

		static list<Enemy*>& getAllEnemys(){
			return _all_active_enemys;
		}

		bool isCollision2Player(Player* player);
	protected:
		list<CCRect> _all_collision_rects;
		float _hp;

	private:
		EnemyType _type;
		static CCNode* _all_enemy_parent;
		static list<Enemy*> _all_active_enemys;

		static list<CreateArg*> _all_create_cmd;
	};
}

#endif